<%--
  Created by IntelliJ IDEA.
  User: 兰宦君
  Date: 2015/10/3
  Time: 14:51
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>网络购书系统后台管理</title>
    <script type="text/javascript">
        function submit() {
            $.ajax({
                url: "/admin/doneLogin.do",
                data: $('#loginForm').serialize(),
                method: "POST",
                dataType: "json",
                error: function () {
                    alert("表单提交出错，请稍后再试");
                },
                success: function(response) {
                    if(response.code == 0) {
                        window.location.href = "/admin/book.do";

                    }
                    else {
                        alert(response.description);
                    }
                }
            });
        }
    </script>
    <%@ include file="../../layout/import.jsp"%>

</head>
<body>
<%@ include file="nav.jsp"%>

<div class="container" style="min-height: 75%">

  <div class="col-md-12">
    <div class="col-md-offset-4 col-md-4">
      <div class="text-center"><h3>欢迎管理员登录</h3></div>
    </div>
    <br /><br />
    <div class="col-md-4 col-md-offset-4">
      <form class="form-horizontal" role="form" method="post" id="loginForm">
        <div class="form-group">
          <label for="username" class="col-sm-4 control-label" for="username">请输入用户名</label>
          <div class="col-sm-8">
            <input type="text" class="form-control" id="username" placeholder="请输入您的用户名" name="username">
          </div>
        </div>
        <div class="form-group">
          <label for="password" class="col-sm-4 control-label" for="password">请输入密码</label>
          <div class="col-sm-8">
            <input type="password" class="form-control" id="password" placeholder="请输入登录密码" name="password">
          </div>
        </div>
        <div class="form-group">
          <div class="text-center">
            <a class="btn btn-primary" onclick="submit()">登录</a>
          </div>
        </div>
      </form>
    </div>
  </div>
</div>
<%@ include file="../footer.jsp"%>
</body>
</html>
